<template>
  <div class="home-card" :class="{ dark: isDark }">
    <div class="home-card-header">
      <h4 class="home-card-title">{{ title }}</h4>
      <div class="home-card-operation">
        <slot name="operation">
          <svg-icon icon-class="align"></svg-icon>
        </slot>
      </div>
    </div>
    <div class="home-card-body">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    isDark: Boolean,
  },
};
</script>

<style lang="scss" scoped>
.home-card {
  + .home-card {
    margin-top: 20px;
  }
  &-header {
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  &-title {
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    color: #000;
    margin: 0;
    font-family: Source Han Sans CN-Medium, Source Han Sans CN;
  }
  &-operation {
    > svg {
      font-size: 20px;
    }
  }

  &.dark {
    padding: 16px 20px;
    background: #f7f8f8;
    border-radius: 4px;
    .home-card-header {
      padding-top: 0;
    }
    + .dark {
      margin-top: 24px;
    }
  }
}
</style>
